home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
oath.lha
/
oath
/
test
/
pdl2b.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-29
|
2KB
|
73 lines
#include "oath/pdlQueue.h"
#include "oath/character.h"
#include <fstream.h>
/////////////////////////////////////////////////////////////////////////////
// Test of pdlQueues and putCopy()/getCopy()
main ()
{// Predefine Four Characters //////////
characterA A = characterA::make('A');
characterA B = characterA::make('B');
characterA C = characterA::make('C');
characterA D = characterA::make('D');
cout << A << B << C << D << endl;
// Retrieve the Three Lists //////////
ifstream File ("pdl2.obj");
pdlQueueA L1 = pdlQueueA::isa(objA::import(File));
pdlQueueA L2 = pdlQueueA::isa(objA::import(File));
pdlQueueA L3 = pdlQueueA::isa(objA::import(File));
// Test Code //////////
if(L1.is(L2) || L1.is(L3))
cout << "is() failed!" << endl;
else
cout << "is() succeeded!" << endl;
if(L1 == L2 && L1 == L3)
cout << "== succeeded!" << endl;
else
cout << "== failed!" << endl;
if(L1.isEmpty() || L2.isEmpty() || L3.isEmpty())
cout << "isEmpty() failed!" << endl;
else
cout << "isEmpty() succeeded!" << endl;
if(L1.contains(A) && L1.contains(B) && !L1.contains(D))
cout << "contains() succeeded!" << endl;
else
cout << "contains() failed!" << endl;
cout << "There are " << L1.count() << " characters in L1: ";
posA P1 = L1.makePos();
while(P1())
{cout << characterA::isa(*P1);
++P1;
}
cout << endl;
cout << "The second character is " << characterA::isa(L1[1]) << endl;
objA O;
L2 >> O;
cout << "The first character removed is "
<< characterA::isa(O) << endl;
cout << "There are " << L2.count() << " characters in L2: ";
posA P2 = L2.makePos();
while(P2())
{cout << characterA::isa(*P2);
++P2;
}
cout << endl;
}